package net.lanelife.casino.caipiao.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

import net.lanelife.casino.common.entity.annotation.Checked;
import net.lanelife.casino.common.entity.support.CheckableEntity;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "TB_BANK_TRANSACTION_DETAIL")
public class BankTransactionDetail extends CheckableEntity<Integer> {

	private static final long serialVersionUID = 4554227252186974565L;

	@Checked
	@Column(name = "SRC_BANK_NAME", length = 10, nullable = false)
	private String sourceBankName;
	
	@Checked
	@Column(name = "SRC_ACCOUNT_NAME", length = 10, nullable = false)
	private String sourceAccountName;
	
	@Checked
	@Column(name = "SRC_ACCOUNT_NO", length = 20, nullable = false)
	private String sourceAccountNo;
	
	@Checked
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "SRC_USES_TYPE", nullable = false)
	private SourceUsesType sourceUsesType;
	
	@Checked
	@Column(name = "DEST_BANK_NAME", length = 10, nullable = false)
	private String destinationBankName;
	
	@Checked
	@Column(name = "DEST_ACCOUNT_NAME", length = 10, nullable = false)
	private String destinationAccountName;
	
	@Checked
	@Column(name = "DEST_ACCOUNT_NO", length = 20, nullable = false)
	private String destinationAccountNo;
	
	@Checked
	@Column(name = "TRANSACTION_AMOUNT", nullable = false)
	private Double transactionAmount;
	
	@Checked
	@Column(name = "TRANSACTION_FEE", nullable = false)
	private Double transactionFee;
	
	@Checked
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "TRANSACTION_DIRECTION", nullable = false)
	private TransactionDirection transactionDirection;
	
	@Checked
	@Column(name = "CURRENT_BALANCE", nullable = false)
	private Double currentBalance;
	
	@Checked
	@Column(name = "USER_NAME", length = 16, nullable = false)
	private String userName;
	
	@Column(name="TRANSACTION_TIME", nullable=false)
	@Type(type = "net.lanelife.casino.common.entity.usertype.PersistentDateTimeAsMillisLong")
	private DateTime transactionTime;
	
	public static enum TransactionDirection {
		IN, OUT
	}
	
	public static enum SourceUsesType {
		CK, SK, ZZ
	}

	public String getSourceBankName() {
		return sourceBankName;
	}

	public void setSourceBankName(String sourceBankName) {
		this.sourceBankName = sourceBankName;
	}

	public String getSourceAccountName() {
		return sourceAccountName;
	}

	public void setSourceAccountName(String sourceAccountName) {
		this.sourceAccountName = sourceAccountName;
	}

	public String getSourceAccountNo() {
		return sourceAccountNo;
	}

	public void setSourceAccountNo(String sourceAccountNo) {
		this.sourceAccountNo = sourceAccountNo;
	}

	public SourceUsesType getSourceUsesType() {
		return sourceUsesType;
	}

	public void setSourceUsesType(SourceUsesType sourceUsesType) {
		this.sourceUsesType = sourceUsesType;
	}

	public String getDestinationBankName() {
		return destinationBankName;
	}

	public void setDestinationBankName(String destinationBankName) {
		this.destinationBankName = destinationBankName;
	}

	public String getDestinationAccountName() {
		return destinationAccountName;
	}

	public void setDestinationAccountName(String destinationAccountName) {
		this.destinationAccountName = destinationAccountName;
	}

	public String getDestinationAccountNo() {
		return destinationAccountNo;
	}

	public void setDestinationAccountNo(String destinationAccountNo) {
		this.destinationAccountNo = destinationAccountNo;
	}

	public Double getTransactionAmount() {
		return transactionAmount;
	}

	public void setTransactionAmount(Double transactionAmount) {
		this.transactionAmount = transactionAmount;
	}

	public Double getTransactionFee() {
		return transactionFee;
	}

	public void setTransactionFee(Double transactionFee) {
		this.transactionFee = transactionFee;
	}

	public TransactionDirection getTransactionDirection() {
		return transactionDirection;
	}

	public void setTransactionDirection(TransactionDirection transactionDirection) {
		this.transactionDirection = transactionDirection;
	}

	public Double getCurrentBalance() {
		return currentBalance;
	}

	public void setCurrentBalance(Double currentBalance) {
		this.currentBalance = currentBalance;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public DateTime getTransactionTime() {
		return transactionTime;
	}

	public void setTransactionTime(DateTime transactionTime) {
		this.transactionTime = transactionTime;
	}
	
}
